@echo off
echo Checking if PyInstaller is installed...
pip show pyinstaller >nul 2>&1
if errorlevel 1 (
    echo PyInstaller not found, installing...
    pip install pyinstaller
) else (
    echo PyInstaller is already installed
)

echo Starting compilation...
pyinstaller --noconfirm ^
    --clean ^
    --name "DataShadow" ^
    --add-data "src/ui;src/ui" ^
    --add-data "sources;sources" ^
    --add-data "README.md;." ^
    --hidden-import "pymysql" ^
    --hidden-import "oracledb" ^
    --hidden-import "pandas" ^
    --hidden-import "numpy" ^
    --hidden-import "openpyxl" ^
    --hidden-import "tkinter" ^
    --hidden-import "json" ^
    --hidden-import "csv" ^
    --noconsole ^
    --onefile ^
    --icon="sources/icon.ico" ^
    main.py

echo Cleaning temporary files...
if exist build rmdir /s /q build
if exist main.spec del /f /q main.spec

echo Compilation completed!
echo Executable file is located in dist directory
pause 